<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo Yii::$app->name;?> 后台管理</title>
<?php $this->HeaderView();?>
</head>
<body class="view_index" id="view_index_Category">
<div class="view-index-nav">
        <h3>自定义字段</h3>
  <p class="tips">
        
        </p>
</div>


<form class="view-index-form" style="margin:0px 20px" method="POST" action="" enctype="multipart/form-data">
<table class="view-index-search mb-10" border="0" cellspacing="0" cellpadding="0" width="100%">
<?=$this->csrfToken()?>
        <tr>
        <td class="search">
        <div class="div-search" style="margin:0px 0px; height:30px">
        <div class="ftr">
        <button class="ui-btn ui-btn-primary mb-10" type="button" onclick="href('<?php echo $this->context->getModelsActionUrl(['create-field', 'modelid'=>$modelid]);?>')"><span class="icon-plus">+</span>添加</button>
        
        
        </div>
       
        <span class="view-index-batch">
        
        </span></div>
         
        </td>
        </tr>
</table>
</form>


<form class="view-index-form" method="post" action="<?php echo $this->context->getModelsActionUrl(['field-batch', 'modelid'=>$modelid]);?>" enctype="multipart/form-data">
<input type="hidden" value="<?php echo $modelid?>" name="modelid" />
<table class="view-index-list" border="0" cellspacing="0" cellpadding="0" width="100%">
    <thead>
        <tr>
          <th width="50">排序</th>
                        <th>字段名称</th>
                        <th width="100">别名</th>
                        <th width="100">控件类型</th>
                        <th width="100">字段类型</th>
                        <th width="60">主表字段</th>
                        <th width="60">允许录入</th>
                        <th width="40">必填</th>
                        <th width="70">状态</th>
            <th class="edit norightborder">操作</th>
        </tr>
    </thead>
    <tbody>
        <?php
	use \submodule\models\Models;
    foreach($rows as $k=>$v){
    ?>
    <tr>
              <td><input class="input-text input-listorder" value="<?php echo $v['listorder'];?>" name="listorder[<?php echo $v['fieldid'];?>]"/></td>
        
        <td><?php echo $v['field'];?></td>
                
        <td><?php echo $v['name'];?></td>
        <td><?php echo \submodule\widgets\Config::widgets($v['formtype']);?></td>
        <td><?php echo $v['fieldtype'].($v['fieldlength'] ? '('.$v['fieldlength'].')' : '');?></td>
        <td><?php echo $v['primarytable'] ? '是' : '否';?></td>
        <td><?php echo $v['allowinput'] ? '是' : '否';?></td>
        <td><?php echo $v['required'] ? '是' : '否';?></td>
        <td class="td-locked"><div onclick="change_switch(this, '<?php echo $this->context->getModelsActionUrl(['field-status', 'field'=>'enabled', 'fieldid'=>$v['fieldid'], 'status'=>'-status-'])?>');" id="btn-locked" class="locked-<?php echo intval($v['enabled']);?>"></div></td> 
                <td class="td-operation">
            <a href="<?php echo $this->context->getModelsActionUrl(['update-field','modelid'=>$v['modelid'], 'fieldid'=>$v['fieldid']])?>" title="编辑" class="operation-update">编辑</a> <a href="<?php echo $this->context->getModelsActionUrl(['delete-field','modelid'=>$v['modelid'], 'fieldid'=>$v['fieldid']])?>" title="删除" class="operation-delete">删除</a></td>
        <?php
}
?>    </tr>
<tr style="background-color:#eee" class="batch">
<td colspan="100">
<div class="pages ftr right">
<?=$this->linkPager($pages)?>
</div>
<input type="button" class="button-submit ml-5" value="全选" name="chkall" id="chkall" onclick="checkAll(this, 'checked_id[]');"><input type="button" class="button-submit button-reverse" value="反选" name="chkall" id="chkall" onclick="checkReverse(this, 'checked_id[]');">

<input id="batch_delete" class="button-submit ml-5" type="submit" value="批量删除" name="batch_delete" onclick="return confirm_delete('checked_id[]', this);">

<input id="submit_search" class="button-submit ml-5" type="submit" value="排序" name="batch_listorder">

</td>
</tr> 
        </tbody>
    
</table>

<?=$this->csrfToken()?>
</form>
<?php $this->FooterView();?>
</body>
</html>